package com.bothin.experiment4.model;

import com.bothin.experiment4.enums.LogistStatusEnum;
import com.bothin.experiment4.utils.EnumUtil;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Table(name = "logist_info")
@Data
public class LogistInfo {
    /**
     * 物流信息主键
     */
    @Id
    private String id;

    @Column(name = "form_id")
    private String formId;

    @Column(name = "logist_company")
    private String logistCompany;

    /**
     * 物流信息：未处理 运输中1 已签收2
     */
    @Column(name = "logist_status")
    private Integer logistStatus;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    public LogistStatusEnum getLogistStatusEnum(){
        return EnumUtil.getByCode(logistStatus,LogistStatusEnum.class);
    }

    public LogistInfo() {
    }

    public LogistInfo(String id, String formId, String logistCompany, Integer logistStatus) {
        this.id = id;
        this.formId = formId;
        this.logistCompany = logistCompany;
        this.logistStatus = logistStatus;
    }
}